namespace BuildingBlocks.Core.Entities;

public abstract class EntityBase<TKey>
{
    public TKey Id { get; protected set; }

    // 可选：重写 Equals/GetHashCode
    public override bool Equals(object obj)
    {
        if (obj is not EntityBase<TKey> entity)
            return false;

        return EqualityComparer<TKey>.Default.Equals(Id, entity.Id);
    }

    public override int GetHashCode()
    {
        return EqualityComparer<TKey>.Default.GetHashCode(Id);
    }
}